#ifndef CAFFICHAGE_H
#define CAFFICHAGE_H

#include "myqglwidget.h"
#include "cmesh.h"
#include "QtOpenGL"
#include "qdebug.h"
#include "QVector"

class CAffichage : public myQGLWidget
{
	Q_OBJECT
public:
	explicit CAffichage(QWidget *parent = 0);
	void initializeGL();
	void resizeGL(int width, int height);
	void paintGL();

	   	void picking(int x, int y);
        void draw_pick();
        void processHits(GLint hits, GLuint *buffer);

	void mousePressEvent(QMouseEvent *event);
	void mouseMoveEvent(QMouseEvent *event);
	void mouseDoubleClickEvent(QMouseEvent *event);

	void add_object(CMesh * obj);
        void remove_object(CMesh * obj);
        void remove_object(int i);
        int nb_objects();
        CMesh * get_object(int i);

        void set_mode_rendu(GLenum mode);
        void enable_lighting();
        void disable_lighting();


        QVector<CMesh*> objets;
private:
	GLfloat rotationX;
	GLfloat rotationY;
	GLfloat rotationZ;
	QPoint  lastPos;
	GLfloat eloign;

        GLenum  mode_rendu;


};

#endif // CAFFICHAGE_H
